<script>
var joinStationIndex = <#if joinstation_list?? && joinstation_list?size gt 0>${joinstation_list?size}<#else>0</#if>;
function addJoinStation() {
	joinStationIndex++;
	var tr = document.createElement();
	var html = '';
	html+="<tr id=\"${field.name}tr" + joinStationIndex + "\" class=\"listviewTR joinstationtr\">";
	html+="<td class=\"listviewTD\" align=\"right\"><span class=\"placeholder fontRed\">*</span>接入变电站名称:</td>";
	html+="<td class=\"listviewContent\" align=\"left\">";
	html+="<input type=\"text\" class=\"text\" style=\"width:133px;\" name=\"fieldMap['${field.name}'].joinStationList["+joinStationIndex+"].name\" datarule=\"string\" datarulejson='{\"displayName\":\"接入变电站名称\",\"dataType\":\"string\",\"isRequired\":\"1\",\"length\":\"100\"}' >";
	html+="</td>";
	
	html+="<td class=\"listviewTD\" align=\"right\"><span class=\"placeholder fontRed\">*</span>接入电压等级:</td>";
	html+="<td class=\"listviewContent\" align=\"left\">";
	html+="<select type=\"text\" class=\"text\" style=\"width:133px;\" name=\"fieldMap['${field.name}'].joinStationList["+joinStationIndex+"].volClass\"}'>";
	html+="<option value=\"500kV\" >500kV</option>"
	html+="<option value=\"220kV\" >220kV</option>"
	html+="</select>"
	html+="</td>";
	
	html+="<td class=\"listviewTD\" align=\"right\"><span class=\"placeholder fontRed\">*</span>接入线路数:</td>";
	html+="<td class=\"listviewContent\" align=\"left\">";
	html+="<input type=\"text\" class=\"text\" style=\"width:133px;\" name=\"fieldMap['${field.name}'].joinStationList["+joinStationIndex+"].lineNumber\" datarule=\"number\" datarulejson='{\"displayName\":\"接入线路数\",\"dataType\":\"number\",\"isRequired\":\"1\",\"length\":\"8\"}' >";
	html+="条</td>";
	html+="</tr>";
	
	html+="<tr id=\"${field.name}tr_1" + joinStationIndex + "\" class=\"listviewTR joinstationtr\">";
	html+="<td class=\"listviewTD\" align=\"right\"><span class=\"placeholder fontRed\">*</span>接入线路长度:</td>";
	html+="<td class=\"listviewContent\" align=\"left\">";
	html+="<input type=\"text\" class=\"text\" style=\"width:133px;\" name=\"fieldMap['${field.name}'].joinStationList["+joinStationIndex+"].lineLength\" datarule=\"number\" datarulejson='{\"displayName\":\"接入线路长度\",\"dataType\":\"number\",\"precision\":\"6\",\"isRequired\":\"1\",\"length\":\"8\"}' >";
	html+="km</td>";
	
	html+="<td class=\"listviewContent\" colspan=\"3\" align=\"right\" style=\"padding-left:10px;\"><a href=\"javascript:void(0);\" onclick=\"removeJoinStation('"+joinStationIndex+"');return false;\">删除</a></td>";
	html+="<td class=\"listviewContent\" colspan=\"1\" align=\"left\">&nbsp;</td>";
	html+="</tr>";
	$(tr).html(html);
	var trArray = $('.joinstationtr');
	$(tr).insertBefore($(trArray[trArray.length-1]));
	validatorForm();
}

function removeJoinStation(index) {
	$(document.getElementById('${field.name}tr'+index)).remove();
	$(document.getElementById('${field.name}tr_1'+index)).remove();
	validatorForm();
}
</script>

<input type=hidden name="fieldMap['${field.name}'].id"  <#if businessInstanceField?? && businessInstanceField.id??>value="${businessInstanceField.id}"</#if>>
<input type=hidden name="fieldMap['${field.name}'].field.id"  value="${formField.field.id}">

<#if formField.readonly?? && formField.readonly=="1">
	<input type=hidden id=${field.name} name="fieldMap['${field.name}'].value" <#if businessInstanceField??>value="${businessInstanceField.value?default('')}"</#if>></input>
	
<#if joinstation_list?? && joinstation_list?size gt 0>
	<#assign index=1>
	<#list joinstation_list as joinstation>
	<tr id="${field.name}tr${index}" class="listviewTR joinstationtr">
		<td class="listviewTD" align="right">
			<span class="placeholder fontRed">*</span>接入变电站名称:
		</td>
		<td class="listviewContent" align="left">
			<input type="hidden" class="text" style="width:133px;" name="fieldMap['${field.name}'].joinStationList[${index}].name" value="${joinstation.name}" >
			${joinstation.name?default('')}
		</td>
		
		<td class="listviewTD" align="right">
			<span class="placeholder fontRed">*</span>接入电压等级:
		</td>
		<td class="listviewContent" align="left">
			<input type="hidden" class="text" style="width:133px;" name="fieldMap['${field.name}'].joinStationList[${index}].volClass" value="${joinstation.volClass}" >
			${joinstation.volClass?default('')}
		</td>
		
		<td class="listviewTD" align="right">
			<span class="placeholder fontRed">*</span>接入线路数:
		</td>
		<td class="listviewContent" align="left">
			<input type="hidden" class="text" style="width:133px;" name="fieldMap['${field.name}'].joinStationList[${index}].lineNumber" value="${joinstation.lineNumber?c}" >
			${joinstation.lineNumber?default('')}
			条
		</td>
		</tr>
		
		<tr id="${field.name}tr_1${index}" class="listviewTR joinstationtr">
		<td class="listviewTD" align="right">
			<span class="placeholder fontRed">*</span>接入线路长度:
		</td>
		<td class="listviewContent" colspan="5" align="left">
			<input type="hidden" class="text" style="width:133px;" name="fieldMap['${field.name}'].joinStationList[${index}].lineLength" value="${joinstation.lineLength?c}" >
			${joinstation.lineLength?default('')}
			km
		</td>
		
	</tr>
	<#assign index=index+1>
	</#list>
</#if>
<#else>

<#if joinstation_list?? && joinstation_list?size gt 0>
	<#assign index=1>
	<#list joinstation_list as joinstation>
	<tr id="${field.name}tr${index}" class="listviewTR joinstationtr">
	
		<td class="listviewTD" align="right">
			<span class="placeholder fontRed">*</span>接入变电站名称:
		</td>
		<td class="listviewContent" align="left">
			<input class="text" style="width:133px;" name="fieldMap['${field.name}'].joinStationList[${index}].name" value="${joinstation.name}" datarule="string" datarulejson='{"displayName":"接入变电站名称","dataType":"string","isRequired":"1","length":"100"}' >
		</td>
		
		<td class="listviewTD" align="right">
			<span class="placeholder fontRed">*</span>接入电压等级:
		</td>
		<td class="listviewContent" align="left">
			<select class="text" style="width:133px;" name="fieldMap['${field.name}'].joinStationList[${index}].volClass" value="${joinstation.volClass}" >
				<option value="500kV" <#if joinstation?? && joinstation.volClass?? && joinstation.volClass=='500kV'>selected</#if>>500kV</option>"
		        <option value="220kV" <#if joinstation?? && joinstation.volClass?? && joinstation.volClass=='220kV'>selected</#if>>220kV</option>"
			</select>
		</td>
		
		<td class="listviewTD" align="right">
			<span class="placeholder fontRed">*</span>接入线路数:
		</td>
		<td class="listviewContent" align="left">
			<input class="text" style="width:133px;" name="fieldMap['${field.name}'].joinStationList[${index}].lineNumber" value="${joinstation.lineNumber?c}" datarule="number" datarulejson='{"displayName":"接入线路数","dataType":"number","isRequired":"1","length":"8"}'>
			条
		</td>
		</tr>
		
		<tr id="${field.name}tr_1${index}" class="listviewTR joinstationtr">
		<td class="listviewTD" align="right">
			<span class="placeholder fontRed">*</span>接入线路长度:
		</td>
		<td class="listviewContent" align="left">
			<input class="text" style="width:133px;" name="fieldMap['${field.name}'].joinStationList[${index}].lineLength" value="${joinstation.lineLength?c}" datarule="number" datarulejson='{"displayName":"接入线路长度","dataType":"number","precision":"6","isRequired":"1","length":"8"}'>
			km
		</td>
	
	<td class="listviewContent" colspan="3" align="right"><a href="javascript:void(0);" onclick="removeJoinStation('${index}');return false;">删除</a></td>
	<td class="listviewContent" colspan="1" >&nbsp;</td>
	</tr>
	<#assign index=index+1>
	</#list>
</#if>
<tr class="listviewTR joinstationtr">
	<td class="listviewTD" align="left">&nbsp;</td>
	<td class="listviewContent" align="left" colspan="5"><a href="#" class="button" tabindex="-1"><input type="button" onclick="addJoinStation();return false;" value="添加"></a></td>
</tr>

</#if>